/*
 * @Author: yanjikun
 * @Date: 2022-05-25 09:53:01
 * @LastEditors: yanjikun
 * @LastEditTime: 2022-05-25 09:56:31
 * @Description: file content
 */

import { useSocketStore } from '@/store/modules/socket'
import { watch } from 'vue'

/**
 * @description: socket推送消息页面局部刷新
 * @param {function} callback 需要刷新的方法
 * @author: yanjikun
 */
export const useSocketEvent = (callback: () => void) => {
  const socketStore = useSocketStore()
  watch(
    () => socketStore.messageData,
    () => {
      callback()
    },
  )
}
